package com.zhang.teachingcommunity_spring.controller.resultType;

import lombok.Data;

//@Data
public class Pagination {
    public int currentPage;
    public int pageSize;
    public int total;
    public int startIndex;
    public Pagination() {
    }

    public Pagination(int currentPage, int pageSize, int total) {
        this.currentPage = currentPage;
        this.pageSize = pageSize;
        this.total = total;
        this.startIndex = (currentPage-1)*pageSize;
    }

    /**
     * 获取
     * @return currentPage
     */
    public int getCurrentPage() {
        return currentPage;
    }

    /**
     * 设置
     * @param currentPage
     */
    public void setCurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }

    /**
     * 获取
     * @return pageSize
     */
    public int getPageSize() {
        return pageSize;
    }

    /**
     * 设置
     * @param pageSize
     */
    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    /**
     * 获取
     * @return total
     */
    public int getTotal() {
        return total;
    }

    /**
     * 设置
     * @param total
     */
    public void setTotal(int total) {
        this.total = total;
    }

    /**
     * 获取
     * @return startIndex
     */
    public int getStartIndex() {
        return startIndex;
    }

    /**
     * 设置
     * @param startIndex
     */
    public void setStartIndex(int startIndex) {
        this.startIndex = startIndex;
    }

    public String toString() {
        return "Pagination{currentPage = " + currentPage + ", pageSize = " + pageSize + ", total = " + total + ", startIndex = " + startIndex + "}";
    }
}
